package cn.iocoder.yudao.module.shop.dal.mysql.itemtimesrecharge;

import java.time.LocalDateTime;
import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.itemtimesrecharge.ShopItemTimesRechargeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.itemtimesrecharge.vo.*;

/**
 * 项目次数充值 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopItemTimesRechargeMapper extends BaseMapperX<ShopItemTimesRechargeDO> {

    default PageResult<ShopItemTimesRechargeDO> selectPage(ShopItemTimesRechargePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopItemTimesRechargeDO>()
                .eqIfPresent(ShopItemTimesRechargeDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(ShopItemTimesRechargeDO::getItemId, reqVO.getItemId())
                .eqIfPresent(ShopItemTimesRechargeDO::getTenantId, reqVO.getTenantId())
                .betweenIfPresent(ShopItemTimesRechargeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopItemTimesRechargeDO::getId));
    }

    default List<ShopItemTimesRechargeDO> selectList(ShopItemTimesRechargeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopItemTimesRechargeDO>()
                .eqIfPresent(ShopItemTimesRechargeDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(ShopItemTimesRechargeDO::getItemId, reqVO.getItemId())
                .eqIfPresent(ShopItemTimesRechargeDO::getTenantId, reqVO.getTenantId())
                .betweenIfPresent(ShopItemTimesRechargeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopItemTimesRechargeDO::getId));
    }

    default Long selectCount(Long memberId){
        return selectCount(new LambdaQueryWrapperX<ShopItemTimesRechargeDO>()
                .eq(ShopItemTimesRechargeDO::getMemberId, memberId));
    }

}
